package ch.unisi.inf.pfii.teamwhite.risk.sound;

/**
 * 
 * @author Matteo Bellan: bellanm@lu.unisi.ch
 * @author Andrea Michelotti: micheloa@lu.unisi.ch
 * @author Ranganathan Ramasubramanian: ramasubr@lu.unisi.ch
 * 
 */

import ch.unisi.inf.pfii.teamwhite.risk.core.Game;
import ch.unisi.inf.pfii.teamwhite.risk.core.GameListener;
import ch.unisi.inf.pfii.teamwhite.risk.core.Planet;
import ch.unisi.inf.pfii.teamwhite.risk.core.player.Human;
import ch.unisi.inf.pfii.teamwhite.risk.core.player.HumanListener;
import ch.unisi.inf.pfii.teamwhite.risk.core.player.Player;
import ch.unisi.inf.pfii.teamwhite.risk.graphic.gameFrame.GameFrame;

public final class SoundInGame {

	private Game game;
	
	private GameFrame gameFrame;
	
	public SoundInGame(final Game game, final GameFrame gameFrame){
		this.game = game;
		
		this.gameFrame = gameFrame;
		
		for (Player player : game.getPlayers()) {
			if(player.getType().equals("Human")){
				((Human)player).addHumanListener(new HumanListener(){

					public void conqueredPlanet(Planet planet) {
					}

					public void moneyChangement() {
					}

					public void planetAssigned() {
					}

					public void planetChangement() {
					}

					public void planetNotAvailable() {
					}

					public void shipChangement() {	
					}

					public void turnFinished() {
					}

					public void attack() {
						new SoundEngine("attack.wav", gameFrame.soundIsEnabled(), false);
					}

					public void moved() {
						new SoundEngine("move.wav", gameFrame.soundIsEnabled(), false);
					}

					public void defensiveShield() {
						new SoundEngine("defensive.wav", gameFrame.soundIsEnabled(), false);
					}

					public void slaveryCamp() {
						new SoundEngine("slavery.wav", gameFrame.soundIsEnabled(), false);
					}

					public void taxCenter() {
						new SoundEngine("tax.wav", gameFrame.soundIsEnabled(), false);
					}
					
					public void eldestCouncil() {
						new SoundEngine("council.wav", gameFrame.soundIsEnabled(), false);
					}
					
				});
			}
		}
		
		game.addGameListener(new GameListener(){

			public void playerLoose(Player player) {
				new SoundEngine("lost.wav", gameFrame.soundIsEnabled(), false);
			}

			public void playerWon(Player player) {
				new SoundEngine("won.wav", gameFrame.soundIsEnabled(), false);
			}
			
		});
	}
}
